package com.example.designer.adapter;

import com.example.designer.adapter.adapter.DuckImpl;
import com.example.designer.adapter.adapter.TurkeyImpl;
import com.example.designer.adapter.impl.Duck;
import com.example.designer.adapter.impl.Turkey;
import com.example.designer.adapter.inter.Adapter;

public class Test {

    public static void main(String[] args) {
        Duck duck = new DuckImpl();//创建鸭子类
        Turkey turkey = new TurkeyImpl();//创建火鸡类
        Duck adapterDuck = new Adapter(turkey);//创建适配器
        //此时火鸡类接口类型和鸭子类型已经一致  也可以写一个双向适配器  让鸭子适配火鸡类接口
        adapterDuck.call();
        adapterDuck.fly();
    }
}
